package com.mjw.zstu.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mjw.zstu.entity.Visitor;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;
@Component
public interface VisitorMapper extends BaseMapper<Visitor> {
    @Select("select exhibition.*,company.company_name,company.emergency_people,company.emergency_contact,visitor.* from visitor,exhibition,company where exhibition.company_id=company.company_id AND exhibition.id=visitor.exhibition_id AND visitor.user_id=#{user_id}")
    public List<Map> getlist(int user_id);
    @Select("select exhibition.*,company.company_name,company.emergency_people,company.emergency_contact,visitor.* from visitor,exhibition,company where exhibition.company_id=company.company_id AND exhibition.id=visitor.exhibition_id AND visitor.visitor_id=#{visitor_id}")
    public Map detail(int visitor_id);
    @Select("select count(*) as value,visitor.exhibition_id from visitor group by exhibition_id order by value limit 0,10")
    public List<Map> ten();
}
